﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace DomusDotNet.Sbm.Client.WP7.Services
{
    public class OpenLibraryCoverProvider: ICoverProvider
    {
        const string URL_FORMAT = "http://covers.openlibrary.org/b/$key/$value-$size.jpg";
        public Uri GetCover(string ISBN, CoverSize size)
        {
            return new Uri(URL_FORMAT
                .Replace("$key", "isbn")
                .Replace("$value", ISBN)
                .Replace("$size", size == CoverSize.Thumbnail ? "S" : "L")
            );
        }
    }
}
